<?php
    include_once("incs/config.inc");
    function __autoload($classname) {
        $classname = strtolower($classname);        
        if (file_exists(LIBMSNP_DIR . FILE_SEP . $classname . ".php"))
            require_once(LIBMSNP_DIR . FILE_SEP . $classname . ".php");
        else if (file_exists(INCLUDES_DIR . FILE_SEP . "dbconnectors" . FILE_SEP . $classname . ".php"))
            require_once(INCLUDES_DIR . FILE_SEP . "dbconnectors" . FILE_SEP . $classname . ".php");
        else if (file_exists(INCLUDES_DIR . FILE_SEP . $classname . ".php"))
            require_once(INCLUDES_DIR . FILE_SEP . $classname . ".php");
    }
    
    $db = Database::getInstance();
    $rslt = $db->select('page_name', 
                        array('page_name'=>'sitemaster'));
    $page = Page::getInstance();
    $page->set_template($rslt->findItem('page_name'));

    if (isset($_GET['page'])) {
        $page->render($_GET['page']);
    } else {
        $page->render('home');
    }
?>